IF OBJECT_ID('ssf.gbl_variable_trg_modified_date') IS NOT NULL
	DROP TRIGGER ssf.gbl_variable_trg_modified_date
GO

CREATE TRIGGER gbl_variable_trg_modified_date
ON ssf.gbl_variable
FOR UPDATE
AS
/*
<object_header>

<object_summary>
	<purpose><![CDATA[
Maintain modified_date of records in ssf.gbl_variable.
	]]></purpose>
</object_summary>

<object_header>
*/

IF EXISTS (
	SELECT 1
	FROM inserted i
	JOIN deleted d
	ON i.variable_id = d.variable_id
	WHERE i.modified_date = d.modified_date
)
BEGIN
	RAISERROR('modified_date should always be updated when updating records in <ssf.gbl_variable>.', 16, 1)
	ROLLBACK TRANSACTION
END
GO
